package org.mydba.util;

public class Profiler {
    private long startTimeNs;
    private long lastTimeNs;

    public Profiler() {
        start();
    }

    public void start() {
        startTimeNs = lastTimeNs = System.nanoTime();
    }

    public long lap() {
        final long current = System.nanoTime();
        final long result =  current - lastTimeNs;
        lastTimeNs = current;
        return (long)(result/1000000.0);
    }

    public long total() {
        return (long)((System.nanoTime() - startTimeNs)/1000000.0);
    }
}
